package com.financial.service.sysconfig.controller;

import com.financial.service.sysconfig.domain.FinancialSysconfigPayDO;
import com.financial.service.sysconfig.service.FinancialSysconfigPayService;
import com.financial.service.sysconfig.util.apiresult.ApiResult;
import com.financial.service.sysconfig.util.page.PageUtils;
import com.financial.service.sysconfig.util.page.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;

/**
 * 支付配置信息主表
 * 
 * @author WANGNING
 * @email wyn20140226@aliyun.com
 * @date 2019-12-05 11:45:56
 */
 
@RestController
@RequestMapping("/pay")
public class FinancialSysconfigPayController {
	@Autowired
	private FinancialSysconfigPayService financialSysconfigPayService;

	/**
	 * 获取支付平台编码
	 * @return ApiResult
	 */
	@PostMapping("/getParamInfo")
	public ApiResult getplatfromNo(@RequestParam String payChannelNo){
		return financialSysconfigPayService.getParamInfo(payChannelNo);
	}

	/**
	 * 获取列表
	 * @param params
	 * @return
	 */
	@GetMapping("/list")
	public PageUtils list(@RequestParam Map<String, Object> params) {
		//查询列表数据
		Query query = new Query(params);
		List<FinancialSysconfigPayDO> financialSysconfigPayList = financialSysconfigPayService.list(query);
		int total = financialSysconfigPayService.count(query);
		PageUtils pageUtils = new PageUtils(financialSysconfigPayList, total);
		return pageUtils;
	}

	/**
	 * 更改数据
	 * @param params
	 * @return ApiResult
	 */
	@PostMapping("/update")
	public ApiResult update(@RequestParam Map<String,Object> params){
		return financialSysconfigPayService.update(params);
	}


	/**
	 * 保存数据
	 * @param params
	 * @return ApiResult
	 */
	@PostMapping("/save")
	public ApiResult save(@RequestParam Map<String,Object> params){
		return financialSysconfigPayService.save(params);
	}
	
}
